package com.xjoyt.pay.master.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xjoyt.pay.controllers.AbstractController;
import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.master.interfaces.MerchantRateContract;
import com.xjoyt.pay.master.params.MerchantPageParam;
import com.xjoyt.pay.master.po.MerchantRate;
import com.xjoyt.pay.master.services.MerchantChannelRateService;
import com.xjoyt.pay.master.services.MerchantRateService;
import com.xjoyt.pay.master.vo.MerchantRateMap;

@RestController
@RequestMapping("merchantRate")
public class MerchantRateController extends AbstractController implements MerchantRateContract {

	@Autowired
	private MerchantRateService service;

	@Autowired
	private MerchantChannelRateService merchantChannelRateService;

	@Override
	public ExecuteResult<MerchantRate> save(@RequestBody MerchantRate param) {
		return service.save(param);
	}

	@Override
	public PageResult<MerchantRateMap> loadPageRate(@RequestBody PageParam<MerchantPageParam> param) {
		return service.loadPage(param);
	}

	@Override
	public ExecuteResult<?> saveRate(@RequestBody MerchantRateMap param) {
		return service.saveRate(param);
	}

	@Override
	public ExecuteResult<?> update(@RequestBody com.xjoyt.pay.merchant.register.po.MerchantRate param) {
		return service.update(param);
	}

	@Override
	public ExecuteResult<?> saveRateForAll(@RequestBody MerchantRateMap param) {
		return merchantChannelRateService.saveRateForAll(param);
	}

}
